package swarm // Package swarm import "xemo.top/docker/docker/api/types/swarm"
import (
	"time"
	"xemo.top/docker/docker/api/types/container"
	"xemo.top/docker/docker/api/types/mount"
)

// SELinuxContext contains the SELinux labels of the container.
type SELinuxContext struct {
	Disable bool
	User    string
	Role    string
	Type    string
	Level   string
}

// CredentialSpec for managed service account (Windows only)
type CredentialSpec struct {
	Config   string
	File     string
	Registry string
}

// Privileges 定义容器的安全选项
// Privileges defines the security options for the container
type Privileges struct {
	CredentialSpec *CredentialSpec
	SELinuxContext *SELinuxContext
}

// ContainerSpec represents the spec of a container
type ContainerSpec struct {
	Image           string                  `json:",omitempty"`
	Labels          map[string]string       `json:",omitempty"`
	Command         []string                `json:",omitempty"`
	Args            []string                `json:",omitempty"`
	Hostname        string                  `json:",omitempty"`
	Env             []string                `json:",omitempty"`
	Dir             string                  `json:",omitempty"`
	User            string                  `json:",omitempty"`
	Groups          []string                `json:",omitempty"`
	Privileges      *Privileges             `json:",omitempty"`
	Init            *bool                   `json:",omitempty"`
	StopSignal      string                  `json:",omitempty"`
	TTY             bool                    `json:",omitempty"`
	OpenStdin       bool                    `json:",omitempty"`
	ReadOnly        bool                    `json:",omitempty"`
	Mounts          []mount.Mount           `json:",omitempty"`
	StopGracePeriod *time.Duration          `json:",omitempty"`
	Healthcheck     *container.HealthConfig `json:",omitempty"`
	// The format of extra hosts on swarmkit is specified in
	Hosts     []string            `json:",omitempty"`
	DNSConfig *DNSConfig          `json:",omitempty"`
	Secrets   []*SecretReference  `json:",omitempty"`
	Configs   []*ConfigReference  `json:",omitempty"`
	Isolation container.Isolation `json:",omitempty"`
	Sysctls   map[string]string   `json:",omitempty"`
}

// DNSConfig 在解析程序配置文件 (resolv.confi) 中指定与DNS相关的配置
// DNSConfig specifies DNS related configuration in resolver configuration file (resolv.confi) Detailed documentation is available in
type DNSConfig struct {
	// Nameservers 指定名称服务器的IP地址
	// Nameservers specifies the IP addresses of the name servers
	Nameservers []string `json:",omitempty"`
	// Search 指定主机名查找的搜索列表
	// Search specifies the search list for host-name lookup
	Search []string `json:",omitempty"`
	// Options 允许修改某些内部解析程序变量
	// Options allows certain internal resolver variables to be modified
	Options []string `json:",omitempty"`
}
